<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Shiro Demo</title>
</head>
<body>
    <h1>首页</h1>
    <h2><lable th:text="${msg}"></lable></h2>
    <h2><lable th:text="${content}"></lable></h2>
    <hr>
    <div th:if="${session.loginUser!=null}">
        <label for="username">欢迎你：</label><label th:text="${username}" id="username"></label>
    </div>
    <br/>

    <!--如果用户为空，则显示登录-->
    <div th:if="${session.loginUser==null}">
        <a th:href="@{/login}">login</a>
    </div>
    <div th:if="${session.loginUser!=null}">
        <a th:href="@{/logout}">logout</a>
    </div>
    <hr>
    <div shiro:hasPermission="user:add"><a th:href="@{/user/add}">Add</a></div>
    <div shiro:hasPermission="user:update"><a th:href="@{/user/update}">Update</a></div>
</body>
</html>